package other;

import java.util.Scanner;

/**
 * Creared with IntelliJ IDEA.
 * Description:一年中的第几天
 * User:yxd
 * Date:2022-03-21
 * Time:20:36
 */
public class Bilibili1 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String s = input.next();
        String[] nums = s.split("-");
        int year = Integer.parseInt(nums[0]);
        int month = Integer.parseInt(nums[1]);
        int day = Integer.parseInt(nums[2]);
        int[] months = {0,31,28,31,30,31,30,31,31,30,31,30};//每月天数
        if(year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)){
            months[2]++;
        }
        int count = day;
        for(int i = 0;i < month;i ++){
            count += months[i];
        }
        System.out.println(count);

    }
}
